<!DOCTYPE html>
<html >
<head>

	<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/dojo/1.9.2/dijit/themes/claro/claro.css">
	<style type="text/css">
@import "//ajax.googleapis.com/ajax/libs/dojo/1.9.2/dojox/grid/resources/claroGrid.css";

/*Grid needs an explicit height by default*/
#gridDiv {
    height: 20em;
}
	</style>
	<script>dojoConfig = {async: true, parseOnLoad: false}</script>
	<script src='//ajax.googleapis.com/ajax/libs/dojo/1.9.2/dojo/dojo.js'></script>
	
	<script>
	
	require(["dojo/store/JsonRest"], function(JsonRest){
	    myStore = new JsonRest({target:"/SpringExample11/hello"});
	});
	require([
	         "dojox/grid/DataGrid",
	         "dojo/data/ObjectStore",
	         "dojo/domReady!"
	     ], function(DataGrid, ObjectStore){
	         grid = new DataGrid({
	             store: dataStore = new ObjectStore({objectStore: myStore}),
	             structure: [
	                 {name:"State Name", field:"name", width: "200px"},
	                 {name:"Abbreviation", field:"abbreviation", width: "200px"},
	                 
	             ]
	         }, "target-node-id"); // make sure you have a target HTML element with this id
	         grid.startup();
	     });
	</script>
</head>
<body class="claro">
    <div id="target-node-id"></div>
</body>
</html>



  var layout = [
	                      {name: 'TestCase No', field: 'id', width: '100px'},
	                      {name: 'TestCase Name', field: 'col2', width: '200px'},
	                      {name: 'Description', field: 'col3', width: '400px'},
	                      {name: 'Type', field: 'col4', width: '100px'},	                      
	                      {name: '', field:'', formatter:up, width:'30px'},
	                      {name: '', field:'', formatter:down, width:'30px'},
	                      {name: '', field:'', formatter:edit, width:'30px'},
	                      {name: '', field:'', formatter:del, width:'30px'}
	        ];

	        var store = new ItemFileReadStore({
	            data: {
	                identifier: "id",
	                items: [
	                        {id: 1, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 2, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 3, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 4, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 5, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 6, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 7, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 8, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 9, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 10, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 11, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 12, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 13, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'},
		                    {id: 14, col2: 'TC Name1', col3: 'Desc 1', col4: 'type1', col5:'XPath1'}	                    
	                ]
	            }
	        });
	        var grid = new DataGrid({
	            id: 'grid',
	            store: store,
	            structure: layout,
	            autoWidth: true,
	            autoHeight: true
	        });
	        grid.placeAt('gridContainer');
	        grid.startup();
	    });
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    helllooo first update1
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    <!DOCTYPE html>
<html>
<head>


<script>
	dojoConfig = {
		parseOnLoad : true
	}
</script>
<script src='dojo/dojo.js'></script>
<link rel="stylesheet" href="dijit/themes/tundra/tundra.css">
<link rel="stylesheet" type="text/css" href="css/style.css" media="all">
<script>
	require([ "dojo/parser", "dijit/TitlePane" ]);
</script>
<script>
	require([ 'dojox/grid/DataGrid', 'dojo/data/ItemFileReadStore',
			'dojo/date/stamp', 'dojo/date/locale', 'dijit/form/Button',
			'dojo/domReady!' ], function(DataGrid, ItemFileReadStore, stamp,
			locale, Button) {

		function down() {
			var w = new Button({
				iconClass : "dijitIcon dijitIconEdit",
			});
			return w;
		}

		function edit() {
			var w = new Button({
				iconClass : "dijitIcon dijitIconEdit",
			});
			return w;
		}

		function up() {
			var w = new Button({
				iconClass : "dijitEditorIcon dijitEditorIconTabIndent",
			});
			return w;
		}

		function del() {
			var w = new Button({
				iconClass : "dijitEditorIcon dijitEditorIconDelete",
			});
			return w;
		}
		

</script>
<script>

require(["dojo/store/JsonRest"], function(JsonRest){
    myStore = new JsonRest({target:"/DojoUi12/gridDetails.htm"});
});
require([
         "dojox/grid/DataGrid",
         "dojo/data/ObjectStore",
         "dojo/domReady!"
     ], function(DataGrid, ObjectStore){
         grid = new DataGrid({
             store: dataStore = new ObjectStore({objectStore: myStore}),
             structure: [
                 {name:"TestCase No", field:"id", width: "100px"},
                 {name:"TestCase Name", field:"TestCaseName", width: "200px"},
                 {name:"Description", field:"Description", width: "400px"},
                 {name:"Type", field:"", width: "100px"},
                 {name:"", field:"", formatter:up, width: "30px"},
                 {name:"", field:"", formatter:down, width: "30px"},
                 {name:"", field:"", formatter:edit, width: "30px"},
                 {name:"", field:"", formatter:del, width: "30px"},
                 
             ]
         }, "gridContainer"); // make sure you have a target HTML element with this id
         grid.startup();
     });
</script>

<script>
	dojo.require("dijit.layout.BorderContainer");
	dojo.require("dijit.layout.ContentPane");
</script>
<style type="text/css">
@import "dojox/grid/resources/tundraGrid.css";
</style>
</head>


<body id="wcq" class="fw-res cdc-login show tundra" style="">

	<div id="fw-skiplinks">
		<ul class="container">
			<li><a href="/" tabindex="3" data-text="SKIP_TO_HOME">Home</a></li>
			<li><a href="#fw-content" data-text="SKIP_TO_CONTENT"
				tabindex="4">Skip to Content</a></li>
			<li><a href="#fw-footer" class="last" data-text="SKIP_TO_FOOTER"
				tabindex="5">Skip to Footer</a></li>
		</ul>
	</div>
	<header id="fw-masthead">
		<div id="fw-banner">
			<button id="fw-treenavbutton" class="">
				<span></span> <span></span> <span></span>
			</button>
			<div id="fw-logo">
				<a href="http://www.cisco.com">Cisco.com Worldwide Home</a>
			</div>
			<nav id="fw-areanav">
				<ul>
					<li><a href="">Products &amp; Services</a></li>
					<li><a data-url="AREA_TAC_URL_GUEST"
						href="/en/US/support/index.html" data-text="AREA_TAC">Support</a></li>
					<li><a data-url="AREA_ORDERING_URL_GUEST"
						href="/web/ordering/root/index.html" data-text="AREA_ORDERING">How
							to Buy</a></li>
					<li><a data-url="AREA_LEARNING_EVENTS_URL"
						href="/web/learning/index.html" data-text="AREA_LEARNING_EVENTS">Training
							&amp; Events</a></li>
					<li><a data-url="AREA_PARTNERS_RESELLERS_URL"
						href="/web/partners/index.html"
						data-text="AREA_PARTNERS_RESELLERS">Partners</a></li>
				</ul>
			</nav>
		</div>
	</header>

	<!-- Start BorderContainer -->
	<div data-dojo-type="dijit/layout/BorderContainer"
		id="borderContainerTwo">

		<!-- TreeGrid -->
		<div data-dojo-type="dijit/layout/AccordionContainer"
			data-dojo-props="region:'leading'">
			<div data-dojo-type="dijit/layout/AccordionPane"
				title="List of Test Functionalities">
				<div data-dojo-type="dijit.layout.ContentPane"
					data-dojo-props="minSize:20, region:'leading'"
					style="width: 300px;" title="Tree View">

					<div data-dojo-type="dojo/store/Memory" data-dojo-id="myStore">
						<!-- Create store with inlined data.
        For larger data sets should use dojo.store.JsonRest etc. instead of dojo.store.Memory. -->
						<script type="dojo/method">
         this.setData([
            { id: 'project', name:'CLIP', type:'module'},
            { id: 'TF-01', name:'TF-01', type:'function', parent: 'project'},         
                    { id: 'TC-0101', name:'TC-0101', type:'testcase',parent: 'TF-01'},
                    { id: 'TC-0102', name:'TC-0102', type:'testcase', parent: 'TF-01' },
			{ id: 'TF-02', name:'TF-02', type:'function', parent: 'project'},         
                    { id: 'TC-0201', name:'TC-0201', type:'testcase',parent: 'TF-02'},
                    { id: 'TC-0202', name:'TC-0202', type:'testcase', parent: 'TF-02' },
			{ id: 'TF-03', name:'TF-03', type:'function', parent: 'project'},         
                    { id: 'TC-0301', name:'TC-0301', type:'testcase',parent: 'TF-03'},
                    { id: 'TC-0302', name:'TC-0302', type:'testcase', parent: 'TF-03' }
            
        ]);
    </script>
						<script type="dojo/method" data-dojo-event="getChildren"
							data-dojo-args="object">
         return this.query({parent: object.id});
    </script>
					</div>

					<!-- Create the model bridging the store and the Tree -->
					<div data-dojo-type="dijit/tree/ObjectStoreModel"
						data-dojo-id="myModel"
						data-dojo-props="store: myStore, query: {id: 'project'}"></div>

					<!-- Create the tree -->
					<script type="text/javascript">
						window.onload = function() {
							document.getElementById("myTree").innerHTML.show();

						}
					</script>

					<div data-dojo-type="dijit/Tree" id="myTree"
						data-dojo-props="model: myModel"></div>

				</div>
			</div>
		</div>

		<!-- end TreeGrid -->

		<div data-dojo-type="dijit/layout/ContentPane"
			data-dojo-props="region:'center'">

			<div data-dojo-type="dijit/layout/AccordionContainer"
				data-dojo-props="region:'leading'">
				<div data-dojo-type="dijit/layout/AccordionPane" title="Description">

					<div id="middlepane" data-dojo-type="dijit/layout/ContentPane"
						data-dojo-props="region:'top'">

						<form action="">
							<table id="table">
								<tr>
									<td width="50px" height="40px"><label for="dtb">Name</label></td>
									<td height="40px">:<input id="dtb"
										data-dojo-type="dijit/form/TextBox" /></td>
								</tr>
								<tr>
									<td width="50px" height="40px"><label for="dtb1">Description</label></td>
									<td height="40px">:<input id="dtb1"
										data-dojo-type="dijit/form/TextBox" /></td>
								</tr>
								<tr>
									<td width="50px" height="40px"><label for="dtb2">Statistics</label></td>
									<td height="40px">:<input id="dtb2"
										data-dojo-type="dijit/form/TextBox" /></td>
								</tr>
							</table>
						</form>
					</div>
				</div>
			</div>
			<div data-dojo-type="dijit/layout/AccordionContainer"
				data-dojo-props="region:'leading'">
				<div data-dojo-type="dijit/layout/AccordionPane" title="Test Cases">

					<div id="btmpane" data-dojo-type="dijit/layout/ContentPane"
						data-dojo-props="region:'leading'">
						<div id="gridContainer"></div>
						<form action="">
							<table>
								<tr>
									<td><input data-dojo-type="dijit/form/TextBox"
										style="width: 100px;" /></td>
									<td><input data-dojo-type="dijit/form/TextBox"
										style="width: 200px;" /></td>
									<td><input data-dojo-type="dijit/form/TextBox"
										style="width: 400px;" /></td>
									<td><input data-dojo-type="dijit/form/TextBox"
										style="width: 100px;" /></td>

								</tr>

							</table>

						</form>
						<center>
							<input type="submit" value="Save"
								data-value="LOGIN_LOCAL_CONTENT_BTN_LOGIN" name="login-button"
								class="button-cta default-command-button" id="login-button">
							<input type="reset" value="Cancel"
								data-value="LOGIN_LOCAL_CONTENT_BTN_LOGIN" name="login-button"
								class="button-cta default-command-button" id="login-button">
						</center>
						</form>
					</div>
				</div>
			</div>
		</div>

	</div>
	<!-- end TabContainer -->
	<!-- end BorderContainer -->



</body>
</html>
DC

























JSONObject j = null;
			
			JSONArray j1 =new JSONArray();
			
			for(int i=0;i<list.size();i++)
			{
				Tree tree =list.get(i);
				j = new JSONObject();
				j.put("name",tree.getName());
				j.put("id",tree.getName()+".htm");
				nextParentList.add(tree.getName());
				j1.add(j);
			}
			j.put("children", j1);
			try {
				j.writeJSONString(response.getWriter());
			} catch (Exception e) {
				e.printStackTrace();
			}

























			<script>
	require([ "dojo/store/JsonRest" ], function(JsonRest) {
		myStore = new JsonRest({
			target : "/DojoUi12/gridDetails.htm"
		});
	});
	require(
			[ "dojox/grid/DataGrid", "dojo/data/ObjectStore", "dojo/domReady!" ],
			function(DataGrid, ObjectStore) {
				grid = new DataGrid({
					store : dataStore = new ObjectStore({
						objectStore : myStore
					}),
					structure : [ {
						name : "TestCase No",
						field : "TestCaseNum",
						width : "100px"
					}, {
						name : "TestCase Name",
						field : "TestCaseName",
						width : "200px"
					}, {
						name : "Description",
						field : "Description",
						width : "400px"
					}, {
						name : "Type",
						field : "Type",
						width : "100px"
					}, {
						name : "",
						field : "",
						width : '30px'
					}, {
						name : "",
						field : "",
						width : '30px'
					}, {
						name : "",
						field : "",
						width : '30px'
					}, {
						name : "",
						field : "",
						width : '30px'
					}

					]
				}, "gridContainer"); // make sure you have a target HTML element with this id
				grid.startup();
			});
</script>
































require([ "dijit/Dialog", "dijit/form/TextBox", "dijit/form/Button" ]);
require(["dojo/query", "dojo/NodeList-traverse"]);
require([ "dojo/parser", "dijit/TitlePane" ]);
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.Tree");
dojo.require("dijit.tree.ForestStoreModel");
dojo.require("dojo.store.JsonRest");
dojo.require("dojo.store.Observable");
dojo.require("dijit.tree.dndSource");

dojo.declare("dojox.grid.SlowFileWriteStore", dojo.data.ItemFileWriteStore, {
	_fetchItems : function( /*Object*/keywordArgs,
	/*Function*/findCallback,
	/*Function*/errorCallback) {
		setTimeout(dojo.hitch(this, function() {
			dojo.data.ItemFileWriteStore.prototype._fetchItems.call(this,
					keywordArgs, findCallback, errorCallback);
		}), 10000);
	}
});

var testfunctionName;

function send(i) {
	testfunctionName = i;

}

function hello() {

	var TestCaseNum = document.getElementById("TestCaseNum").value;
	var TestCaseName = document.getElementById("TestCaseName").value;
	var Description = document.getElementById("Description").value;
	var Type = document.getElementById("Type").value;

	var gridData = {
		'testcaseNum' : TestCaseNum,
		'testCaseName' : TestCaseName,
		'description' : Description,
		'type' : Type
	};
	dojo
			.xhrPost({
				url : 'addTestCase',
				postData : dojo.toJson(gridData),
				handleAs : "json",
				headers : {
					'Content-Type' : 'application/json',
				},
				load : function(response) {

					console.log('Response: ' + response);
					alert('JSON received from server:' + response);
					var newStore, args = {}, text1 = dijit.byId("name"), text2 = dijit
							.byId("description"), text3 = dijit
							.byId("statistics"), grid = dijit.byId("grid");
					args.url = "gridDetails/" + testfunctionName;
					newStore = new dojo.data.ItemFileWriteStore(args);
					grid.setStore(newStore);

					refreshTreeInformation();
				},
				error : function(error) {
					console.log(error);
					alert('error occurred, check the console!');
				}
			});

}

dojo.extend(dijit.Tree, {
	refreshModel : function() {

		// reset the itemNodes Map
		this._itemNodesMap = {};

		// remove the rootNode
		if (this.rootNode) {
			this.rootNode.destroyRecursive();
		}

		// reload the tree
		this._load();
	}
});
function refreshTreeInformation() {
	var treeObject = dijit.byId("tree");
	treeObject.refreshModel();
}

function clickok() {
	var cl = dijit.byId("middlepane");
	cl.set("href", "contentPaneChange/"+testfunctionName);
	clickok1();
}

function clickok1() {
	var cl = dijit.byId("btmpane");
	cl.set("href", "btmPaneChange/"+testfunctionName);
}

function ram() {
	usGov = dojo.store
			.JsonRest({
				target : "hello/",
				mayHaveChildren : function(object) {
					// see if it has a children property
					return "children" in object;
				},
				getChildren : function(object, onComplete, onError) {
					// retrieve the full copy of the object
					this.get(object.id).then(function(fullObject) {
						// copy to the original object so it has the children array as well.
						object.children = fullObject.children;
						// now that full object, we should have an array of children
						onComplete(fullObject.children);
					}, function(error) {
						// an error occurred, log it, and indicate no children
						console.error(error);
						onComplete([]);
					});
				},
				getRoot : function(onItem, onError) {
					// get the root object, we will do a get() and callback the result
					this.get("CLIP").then(onItem, onError);
				},
				getLabel : function(object) {
					// just get the name
					return object.name;
				},

				pasteItem : function(child, oldParent, newParent, bCopy,
						insertIndex) {
					var store = this;
					store
							.get(oldParent.id)
							.then(
									function(oldParent) {
										store
												.get(newParent.id)
												.then(
														function(newParent) {
															var oldChildren = oldParent.children;
															dojo
																	.some(
																			oldChildren,
																			function(
																					oldChild,
																					i) {
																				if (oldChild.id == child.id) {
																					oldChildren
																							.splice(
																									i,
																									1);
																					return true; // done
																				}
																			});
															store
																	.put(oldParent);
															newParent.children
																	.splice(
																			insertIndex || 0,
																			0,
																			child);
															store
																	.put(newParent);
														},
														function(error) {
															alert("Error occurred (this demo is not hooked up to a real database, so this is expected): "
																	+ error);
														});
									});
				},
				put : function(object, options) {
					//this.onChange(object);
					this.onChildrenChange(object, object.children);
					this.onChange(object);
					return dojo.store.JsonRest.prototype.put.apply(this,
							arguments);
				}
			});
	tree = new dijit.Tree({
		model : usGov,
		dndController : dijit.tree.dndSource
	}, "tree"); // make sure you have a target HTML element with this id
	tree.startup();

	dojo
			.connect(
					tree,
					"onClick",
					function createStore(object) {

						send(object.id);
						clickok();
						
						alert("id" + object.id);
						alert("parent"+object.parent);
						 id = object.id;
						var ram = dijit.byId("tree").selectedNode.getParent().id;
						
						var xhrArgs = {
								url : "hello123456/" + ram,
								handleAs : "json",

							}
							var deferred = dojo.xhrPost(xhrArgs);
						deferred.addCallback()
						{
							another();
						}
					});
}

function another()
{
	var id = testfunctionName;
	alert("tf"+id);

// Create a new datastore and use the Grid's setStore() function to change it.
var newStore, args = {}, text1 = dijit.byId("name"), text2 = dijit
		.byId("description"), text3 = dijit
		.byId("statistics"), grid = dijit.byId("grid");

args.url = "gridDetails/" + id;
newStore = new dojo.data.ItemFileWriteStore(args);
grid.setStore(newStore);

var xhrArgs = {
	url : "hello12345/" + id,
	handleAs : "json",

}
var deferred = dojo.xhrPost(xhrArgs);

deferred.addCallback(this, function(value) {
	// put retrieved picklists in select.options[]
	var books = value.books;
	text1.setValue(books[0].name);
	text2.setValue(books[1].name);
	text3.setValue(books[2].name);
});

	}







































	require([ "dijit/Dialog", "dijit/form/TextBox", "dijit/form/Button" ]);
require(["dojo/query", "dojo/NodeList-traverse"]);
require([ "dojo/parser", "dijit/TitlePane" ]);
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.Tree");
dojo.require("dijit.tree.ForestStoreModel");
dojo.require("dojo.store.JsonRest");
dojo.require("dojo.store.Observable");
dojo.require("dijit.tree.dndSource");

dojo.declare("dojox.grid.SlowFileWriteStore", dojo.data.ItemFileWriteStore, {
	_fetchItems : function( /*Object*/keywordArgs,
	/*Function*/findCallback,
	/*Function*/errorCallback) {
		setTimeout(dojo.hitch(this, function() {
			dojo.data.ItemFileWriteStore.prototype._fetchItems.call(this,
					keywordArgs, findCallback, errorCallback);
		}), 10000);
	}
});

var testfunctionName;

function send(i) {
	testfunctionName = i;

}

function hello() {

	var TestCaseNum = document.getElementById("TestCaseNum").value;
	var TestCaseName = document.getElementById("TestCaseName").value;
	var Description = document.getElementById("Description").value;
	var Type = document.getElementById("Type").value;

	var gridData = {
		'testcaseNum' : TestCaseNum,
		'testCaseName' : TestCaseName,
		'description' : Description,
		'type' : Type
	};
	dojo
			.xhrPost({
				url : 'addTestCase',
				postData : dojo.toJson(gridData),
				handleAs : "json",
				headers : {
					'Content-Type' : 'application/json',
				},
				load : function(response) {

					console.log('Response: ' + response);
					alert('JSON received from server:' + response);
					var newStore, args = {}, text1 = dijit.byId("name"), text2 = dijit
							.byId("description"), text3 = dijit
							.byId("statistics"), grid = dijit.byId("grid");
					args.url = "gridDetails/" + testfunctionName;
					newStore = new dojo.data.ItemFileWriteStore(args);
					grid.setStore(newStore);

					refreshTreeInformation();
				},
				error : function(error) {
					console.log(error);
					alert('error occurred, check the console!');
				}
			});

}

dojo.extend(dijit.Tree, {
	refreshModel : function() {

		// reset the itemNodes Map
		this._itemNodesMap = {};

		// remove the rootNode
		if (this.rootNode) {
			this.rootNode.destroyRecursive();
		}

		// reload the tree
		this._load();
	}
});
function refreshTreeInformation() {
	var treeObject = dijit.byId("tree");
	treeObject.refreshModel();
}

function clickok() {
	var cl = dijit.byId("middlepane");
	cl.set("href", "contentPaneChange/"+testfunctionName);
	clickok1();
}

function clickok1() {
	var cl = dijit.byId("btmpane");
	cl.set("href", "btmPaneChange/"+testfunctionName);
}

function ram() {
	usGov = dojo.store
			.JsonRest({
				target : "hello/",
				mayHaveChildren : function(object) {
					// see if it has a children property
					return "children" in object;
				},
				getChildren : function(object, onComplete, onError) {
					// retrieve the full copy of the object
					this.get(object.id).then(function(fullObject) {
						// copy to the original object so it has the children array as well.
						object.children = fullObject.children;
						// now that full object, we should have an array of children
						onComplete(fullObject.children);
					}, function(error) {
						// an error occurred, log it, and indicate no children
						console.error(error);
						onComplete([]);
					});
				},
				getRoot : function(onItem, onError) {
					// get the root object, we will do a get() and callback the result
					this.get("CLIP").then(onItem, onError);
				},
				getLabel : function(object) {
					// just get the name
					return object.name;
				},

				pasteItem : function(child, oldParent, newParent, bCopy,
						insertIndex) {
					var store = this;
					store
							.get(oldParent.id)
							.then(
									function(oldParent) {
										store
												.get(newParent.id)
												.then(
														function(newParent) {
															var oldChildren = oldParent.children;
															dojo
																	.some(
																			oldChildren,
																			function(
																					oldChild,
																					i) {
																				if (oldChild.id == child.id) {
																					oldChildren
																							.splice(
																									i,
																									1);
																					return true; // done
																				}
																			});
															store
																	.put(oldParent);
															newParent.children
																	.splice(
																			insertIndex || 0,
																			0,
																			child);
															store
																	.put(newParent);
														},
														function(error) {
															alert("Error occurred (this demo is not hooked up to a real database, so this is expected): "
																	+ error);
														});
									});
				},
				put : function(object, options) {
					//this.onChange(object);
					this.onChildrenChange(object, object.children);
					this.onChange(object);
					return dojo.store.JsonRest.prototype.put.apply(this,
							arguments);
				}
			});
	tree = new dijit.Tree({
		model : usGov,
		dndController : dijit.tree.dndSource
	}, "tree"); // make sure you have a target HTML element with this id
	tree.startup();

	dojo
			.connect(
					tree,
					"onClick",
					function createStore(object) {

						send(object.id);
						clickok();
						
						alert("id" + object.id);
						alert("parent"+object.parent);
						 id = object.id;
						var ram = dijit.byId("tree").selectedNode.getParent().id;
						
						var xhrArgs = {
								url : "hello123456/" + ram,
								handleAs : "json",

							}
							var deferred = dojo.xhrPost(xhrArgs);
						if(id.contains("Tf"))
							{
							
						// Create a new datastore and use the Grid's setStore() function to change it.
						var newStore, args = {}, text1 = dijit.byId("name"), text2 = dijit
								.byId("description"), text3 = dijit
								.byId("statistics"), grid = dijit.byId("grid");
						
						args.url = "gridDetails/" + object.id;
						newStore = new dojo.data.ItemFileWriteStore(args);
						grid.setStore(newStore);

						var xhrArgs = {
							url : "hello12345/" + object.id,
							handleAs : "json",

						}
						var deferred = dojo.xhrPost(xhrArgs);

						deferred.addCallback(this, function(value) {
							// put retrieved picklists in select.options[]
							var books = value.books;
							text1.setValue(books[0].name);
							text2.setValue(books[1].name);
							text3.setValue(books[2].name);
						});
					}
						else if(id.contains("Tc"))
						{
						
					// Create a new datastore and use the Grid's setStore() function to change it.
					var newStore, args = {}, text1 = dijit.byId("name"), text2 = dijit
							.byId("description"), grid = dijit.byId("grid");
					args.url = "gridDetails/" + object.id;
					newStore = new dojo.data.ItemFileWriteStore(args);
					grid.setStore(newStore);

					var xhrArgs = {
						url : "hello12345/" + object.id,
						handleAs : "json",

					}
					var deferred = dojo.xhrPost(xhrArgs);

					deferred.addCallback(this, function(value) {
						// put retrieved picklists in select.options[]
						var books = value.books;
						text1.setValue(books[0].name);
						text2.setValue(books[1].name);
						text3.setValue(books[2].name);
					});
				}
					});
}





































<!DOCTYPE html>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>

<script>dojoConfig = {parseOnLoad: true}</script>
<script src="<c:url value="/resources/dojo/dojo.js" />"></script>
<link rel="stylesheet"
	href="<c:url value="/resources/dijit/themes/claro/claro.css" /> ">

<script>

<script>
function clickok()
{
	alert("start");
	dojo.xhrPost({
		url : 'addTestCase',
		form:dojo.byId("myForm")
	
});
	alert("end");
}

</script>

</script>
<script>
require(["dojo/parser", "dijit/form/Form", "dijit/form/Button", "dijit/form/ValidationTextBox", "dijit/form/DateTextBox"]);
	</script>
</head>
<body class="claro">
<input type="submit" value="Save" name="login-button"
								class="button-cta default-command-button" id="login-button"
								onClick="myDialog1.show();">

	<div data-dojo-type="dijit/Dialog" data-dojo-id="myDialog1"
		title="TestCase Field Details" id="dailogue1">
		<div data-dojo-type="dijit/form/Form" id="myForm"
			data-dojo-id="myForm" encType="multipart/form-data" method="post">


			<script type="dojo/on" data-dojo-event="submit">
        if(this.validate()){
            clickok();
        }else{
            alert('Form contains invalid data.  Please correct first');
            return false;
        }
        return true;
    </script>
			<script>
   var counter = 1;
   var limit = 3;
   function addInput(divName){
        if (counter == limit)  {
             alert("You have reached the limit of adding " + counter + " inputs");
        }
        else {
             var newdiv = document.createElement('div');
             newdiv.innerHTML = "<table> <tr><td><label for='name'>Name:</label></td><td><input type='text' id='name' name='name' required='true' data-dojo-type='dijit/form/ValidationTextBox'/></td></tr><tr><td><label for='dob'>Date of birth:</label></td><td><input type='text' id='dob' name='dob' required='true' data-dojo-type='dijit/form/ValidationTextBox'/></td></tr></table>";
             document.getElementById(divName).appendChild(newdiv);
             counter++;
        }
   }
   </script>
		
			<table>
			<tr>
<th>Name</th>
<th>dob</th>
</tr>
				<tr>
					<td><input type="text" id="name" name="name" required="true"
						data-dojo-type="dijit/form/ValidationTextBox" /></td>
					<td><input type="text" id="dob" name="dob"
						data-dojo-type="dijit/form/ValidationTextBox" required="true" />
					</td>
					<td><button  type="button"
				name="Button" value="Add" onclick="addInput('dynamicInput');">ADD</button>
					</td>
				</tr>

			</table>
			<div id="dynamicInput"></div>

			<button data-dojo-type="dijit/form/Button" type="submit">Submit</button>
			
		</div>
		
			<button type="reset">Reset</button>
	</div>
</body>
</html>


















<!DOCTYPE script PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/jsp/LoadingUrl.jsp"%>
<script src="<c:url value="/resources/js/totaljs.js" />"></script>


<body id="wcq" class="fw-res cdc-login show tundra" style=""
	onload="welcomePageLoad();">

	<div id="fw-skiplinks">
		<ul class="container">
			<li><a href="/" tabindex="3" data-text="SKIP_TO_HOME">Home</a></li>
			<li><a href="#fw-content" data-text="SKIP_TO_CONTENT"
				tabindex="4">Skip to Content</a></li>
			<li><a href="#fw-footer" class="last" data-text="SKIP_TO_FOOTER"
				tabindex="5">Skip to Footer</a></li>
		</ul>
	</div>
	<header id="fw-masthead">
	<div id="fw-banner">
		<button id="fw-treenavbutton" class="">
			<span></span> <span></span> <span></span>
		</button>
		<div id="fw-logo">
			<a href="http://www.cisco.com">Cisco.com Worldwide Home</a>
		</div>
		<nav id="fw-areanav">
		<ul>
			<li><a href="">Products &amp; Services</a></li>
			<li><a data-url="AREA_TAC_URL_GUEST"
				href="/en/US/support/index.html" data-text="AREA_TAC">Support</a></li>
			<li><a data-url="AREA_ORDERING_URL_GUEST"
				href="/web/ordering/root/index.html" data-text="AREA_ORDERING">How
					to Buy</a></li>
			<li><a data-url="AREA_LEARNING_EVENTS_URL"
				href="/web/learning/index.html" data-text="AREA_LEARNING_EVENTS">Training
					&amp; Events</a></li>
			<li><a data-url="AREA_PARTNERS_RESELLERS_URL"
				href="/web/partners/index.html" data-text="AREA_PARTNERS_RESELLERS">Partners</a></li>
		</ul>
		</nav>
	</div>
	</header>

	<!-- Start BorderContainer -->
	<div data-dojo-type="dijit/layout/BorderContainer"
		id="borderContainerTwo">

		<!-- TreeGrid -->
		<div data-dojo-type="dijit/layout/AccordionContainer"
			data-dojo-props="region:'leading'">
			<div data-dojo-type="dijit/layout/AccordionPane"
				title="List of Test Functionalities">
				<div data-dojo-type="dijit.layout.ContentPane"
					data-dojo-props="minSize:20, region:'leading'"
					style="width: 300px;" title="Tree View">
					<div id="tree"></div>
					<script>
						dojo.require("dojo.store.JsonRest");
						dojo.require("dojo.store.Observable");
						dojo.require("dijit.Tree");
						dojo.require("dijit.tree.dndSource");
						dojo.ready(function() {
							treeLoad();
						});
					</script>

				</div>
			</div>
		</div>
		<!-- end TreeGrid -->
		<!-- right hand part starts -->
		<div data-dojo-type="dijit/layout/ContentPane"
			data-dojo-props="region:'center'" id="content_pane_1">
			<!-- right hand upper starts-->
			<div data-dojo-type="dijit/layout/AccordionContainer"
				data-dojo-props="region:'leading'">
				<div data-dojo-type="dijit/layout/AccordionPane" title="Description">
					<!-- middle pane for Tf description-->
					<div id="middlepane" data-dojo-type="dijit/layout/ContentPane"
						data-dojo-props="region:'top'">

						<form action="">
							<table id="table">
								<tr>
									<td width="50px" height="40px"><label for="TFname">Name</label></td>
									<td height="40px">:<input id="TFname" name="TFname"
										data-dojo-type="dijit/form/TextBox" /></td>
								</tr>
								<tr>
									<td width="50px" height="40px"><label for="TFdescription">Description</label></td>
									<td height="40px">:<input id="TFdescription"
										name="TFdescription" data-dojo-type="dijit/form/TextBox" /></td>
								</tr>
								<tr>
									<td width="50px" height="40px"><label for="TFstatistics">Statistics</label></td>
									<td height="40px">:<input id="TFstatistics"
										name="TFstatistics" data-dojo-type="dijit/form/TextBox" /></td>
								</tr>
							</table>
						</form>
					</div>

					<!-- end of middle pane for Tf description-->
					<!-- middle pane1 for Tc description -->
					<div id="middlepane1" data-dojo-type="dijit/layout/ContentPane"
						data-dojo-props="region:'top'">

						<form action="">
							<table id="table">
								<tr>
									<td width="50px" height="40px"><label for="TCname">Name</label></td>
									<td height="40px">:<input id="TCname" name="TCname"
										data-dojo-type="dijit/form/TextBox" /></td>
								</tr>
								<tr>
									<td width="50px" height="40px"><label for="TCdescription">Description</label></td>
									<td height="40px">:<input id="TCdescription"
										name="TCdescription" data-dojo-type="dijit/form/TextBox" /></td>
								</tr>

							</table>
						</form>
					</div>
					<!-- end of middle pane1 for Tc description -->
				</div>
			</div>
			<!-- end of right hand upper starts-->
			<!-- right hand lower starts-->

			<!-- bottom pane for Tf datagrid-->
			<div data-dojo-type="dijit/layout/AccordionContainer" id="accordion"
				data-dojo-props="region:'leading'">

				<div data-dojo-type="dijit/layout/AccordionPane"
					title="Test Functionality">

					<div id="btmpane" data-dojo-type="dijit/layout/ContentPane"
						data-dojo-props="region:'leading'">

						<div id="gridContainer"></div>

					</div>
					<center>
						<input type="submit" value="Save" name="login-button"
							class="button-cta default-command-button" id="login-button"
							onClick="myDialog.show();"> <input type="reset"
							value="Cancel" name="login-button"
							class="button-cta default-command-button" id="login-button">
					</center>
				</div>
			</div>
			<!--end of bottom pane for Tf datagrid-->
			<!-- bottom pane for Tc datagrid-->
			<div data-dojo-type="dijit/layout/AccordionContainer" id="accordion1"
				data-dojo-props="region:'leading'">
				<div data-dojo-type="dijit/layout/AccordionPane" title="Test Case"
					id="accpane">

					<div id="btmpane1" data-dojo-type="dijit/layout/ContentPane"
						data-dojo-props="region:'leading'">

						<div id="grid"></div>

						<center>
							<input type="submit" value="Save" name="login-button"
								class="button-cta default-command-button" id="login-button"
								onClick="myDialog1.show();"> <input type="reset"
								value="Cancel" name="login-button"
								class="button-cta default-command-button" id="login-button">
						</center>

					</div>

				</div>
			</div>
			<!--end of bottom pane for Tc datagrid-->

			<!--end of lower part-->
		</div>
		<!--end of RIGHT HAND SIDE-->
	</div>
	<!-- end BorderContainer -->
	<!-- myDialog starts-->
	<div data-dojo-type="dijit/Dialog" data-dojo-id="myDialog"
		title="TestCase Details" id="dailogue">
		<div data-dojo-type="dijit/form/Form" id="myForm"
			data-dojo-id="myForm" encType="multipart/form-data" method="post">
		<table class="dijitDialogPaneContentArea">
			<tr>
				<th>TestCaseNum</th>
				<th>TestCaseName</th>
				<th>Description</th>
				<th>Type</th>
			</tr>
			<tr>
				<td><input data-dojo-type="dijit/form/TextBox" class='textbox2'
					name="TestCaseNum" id="TestCaseNum" ></td>
				<td><input data-dojo-type="dijit/form/TextBox" class='textbox2'
					name="TestCaseName" id="TestCaseName"></td>
				<td><input data-dojo-type="dijit/form/TextBox" class='textbox2'
					name="Description" id="Description"></td>
				<td><input data-dojo-type="dijit/form/TextBox" name="Type" class='textbox2'
					id="Type"></td>

			</tr>
		</table>
		<div id="dynamicInput"></div>
		<div class="dijitDialogPaneActionBar">
			<center>
				<input type="submit" value="Ok" class="but123456" id="ok"
					onClick="addTestCase();myDialog.hide();"> <input
					type="button" value="cancel" class="but123456" id="cancel"
					onClick="myDialog.hide();"> <input type="button"
					value="Add" class="but123456" id="addTc"
					onClick="addTestCases('dynamicInput');">
			</center>
			</div>
		</div>

	</div>
	<!-- myDialog ends-->
	<!-- myDialog1 starts-->
	<div data-dojo-type="dijit/Dialog" data-dojo-id="myDialog1"
		title="TestCase Field Details" id="dailogue1">
		<table class="dijitDialogPaneContentArea">
			<tr>
				<th>FieldName</th>
				<th>Fieldtype</th>
				<th>Permission</th>
				<th>FieldValue</th>
				<th>Xpath</th>
			</tr>
			<tr>
				<td><input data-dojo-type="dijit/form/TextBox" name="FieldName" 
					id="FieldName"></td>
				<td><input data-dojo-type="dijit/form/TextBox" name="Fieldtype"
					id="Fieldtype"></td>
				<td><input data-dojo-type="dijit/form/TextBox"
					name="Permission" id="Permission"></td>
				<td><input data-dojo-type="dijit/form/TextBox"
					name="FieldValue" id="FieldValue"></td>
				<td><input data-dojo-type="dijit/form/TextBox" name="Xpath"
					id="Xpath"></td>

			</tr>
		</table>

		<div class="dijitDialogPaneActionBar">
			<center>

				<input type="submit" value="Ok" class="but123456" id="ok1"
					onClick="addTestCaseFields();myDialog1.hide();"> 
					<input type="button" value="cancel" class="but123456" id="cancel1"
					onClick="myDialog1.hide();">
			</center>
		</div>
	</div>
	<!-- myDialog1 ends-->

</body>
</html>






























var dojoConfig = {
	parseOnLoad : true
};
require([ "dijit/Dialog", "dijit/form/TextBox", "dijit/form/Button" ]);
require([ "dojo/query", "dojo/NodeList-traverse" ]);
require([ "dojo/parser", "dijit/TitlePane" ]);
dojo.require("dijit/dijit"); // optimize: load dijit layer
dojo.require("dojox/grid/DataGrid");
dojo.require("dojo/data/ItemFileWriteStore");
dojo.require("dijit/layout/BorderContainer");
dojo.require("dijit/layout/ContentPane");
dojo.require("dijit/Tree");
dojo.require("dijit/tree/ForestStoreModel");
dojo.require("dojo/store/JsonRest");
dojo.require("dojo/store/Observable");
dojo.require("dijit/tree/dndSource");
dojo.require("dijit/form/ValidationTextBox");
//lazy load tree
dojo.declare("dojox/grid/SlowFileWriteStore", dojo.data.ItemFileWriteStore, {
	_fetchItems : function( /*Object*/keywordArgs,
	/*Function*/findCallback,
	/*Function*/errorCallback) {
		setTimeout(dojo.hitch(this, function() {
			dojo.data.ItemFileWriteStore.prototype._fetchItems.call(this,
					keywordArgs, findCallback, errorCallback);
		}), 10000);
	}
});

//Get TestFunName
var testfunctionName;
var Tcparent;
function send(mname,parent) {
	testfunctionName = mname;
	Tcparent =parent;

}

//addTestCase
function addTestCase() {
alert("step1");
	var TestCaseNum = document.getElementById("TestCaseNum").value;
	var TestCaseName = document.getElementById("TestCaseName").value;
	var Description = document.getElementById("Description").value;
	var Type = document.getElementById("Type").value;
    var parent =testfunctionName;
	var gridData = {
		'testcaseNum' : TestCaseNum,
		'testCaseName' : TestCaseName,
		'description' : Description,
		'type' : Type,
		'parent':parent
	};
	dojo.xhrPost({
		url : 'addTestCase',
		postData : dojo.toJson(gridData),
		handleAs : "json",
		headers : {
			'Content-Type' : 'application/json',
		},
		load : function(response) {

			alert('JSON received from server:' + response);
			var newStore, args = {}, grid = dijit.byId("gridContainer");
			args.url = "TFgridDetails/" + testfunctionName;
			newStore = new dojo.data.ItemFileWriteStore(args);
			grid.setStore(newStore);
			refreshTreeInformation();
		},
		error : function(error) {
			console.log(error);
			alert('error occurred, check the console!');
		}
	});

}

//add TestCase Fields
function addTestCaseFields() {

	var FieldName = document.getElementById("FieldName").value;
	var Fieldtype = document.getElementById("Fieldtype").value;
	var Permission = document.getElementById("Permission").value;
	var FieldValue = document.getElementById("FieldValue").value;
	var Xpath = document.getElementById("Xpath").value;
	var gridData = {
		'fieldName' : FieldName,
		'fieldType' : Fieldtype,
		'permission' : Permission,
		'fieldValue' : FieldValue,
		'xpath':Xpath
	};
	dojo.xhrPost({
		url : 'addTestCaseFields/'+ testfunctionName+"/"+Tcparent,
		postData : dojo.toJson(gridData),
		handleAs : "json",
		headers : {
			'Content-Type' : 'application/json',
		},
		load : function(response) {

			alert('JSON received from server:' + response);
			var newStore, args = {}, grid = dijit.byId("grid");
			args.url = "TCgridDetails/" + testfunctionName+"/"+Tcparent;
			newStore = new dojo.data.ItemFileWriteStore(args);
			grid.setStore(newStore);
			refreshTreeInformation();
		},
		error : function(error) {
			console.log(error);
			alert('error occurred, check the console!');
		}
	});

}








//refresh Tree
dojo.extend(dijit.Tree, {
	refreshModel : function() {

		// reset the itemNodes Map
		this._itemNodesMap = {};

		// remove the rootNode
		if (this.rootNode) {
			this.rootNode.destroyRecursive();
		}

		// reload the tree
		this._load();
	}
});

//refresh Tree fun
function refreshTreeInformation() {
	var treeObject = dijit.byId("tree");
	treeObject.refreshModel();
}

//Tree load  fun
function treeLoad() {
	usGov = dojo.store
			.JsonRest({
				target : "TreeLoading/",
				mayHaveChildren : function(object) {
					// see if it has a children property
					return "children" in object;
				},
				getChildren : function(object, onComplete, onError) {
					// retrieve the full copy of the object(important to sending parent)
					this.get(object.name + "/" + object.nodeType).then(
							function(fullObject) {
								// copy to the original object so it has the children array as well.
								object.children = fullObject.children;
								// now that full object, we should have an array of children
								onComplete(fullObject.children);
							}, function(error) {
								// an error occurred, log it, and indicate no children
								console.error(error);
								onComplete([]);
							});
				},
				getRoot : function(onItem, onError) {
					// get the root object, we will do a get() and callback the result
					this.get("CLIP/root").then(onItem, onError);
				},
				getLabel : function(object) {
					// just get the name
					return object.name;
				},

				pasteItem : function(child, oldParent, newParent, bCopy,
						insertIndex) {
					var store = this;
					store
							.get(oldParent.id)
							.then(
									function(oldParent) {
										store
												.get(newParent.id)
												.then(
														function(newParent) {
															var oldChildren = oldParent.children;
															dojo
																	.some(
																			oldChildren,
																			function(
																					oldChild,
																					i) {
																				if (oldChild.id == child.id) {
																					oldChildren
																							.splice(
																									i,
																									1);
																					return true; // done
																				}
																			});
															store
																	.put(oldParent);
															newParent.children
																	.splice(
																			insertIndex || 0,
																			0,
																			child);
															store
																	.put(newParent);
														},
														function(error) {
															alert("Error occurred (this demo is not hooked up to a real database, so this is expected): "
																	+ error);
														});
									});
				},
				put : function(object, options) {
					//this.onChange(object);
					this.onChildrenChange(object, object.children);
					this.onChange(object);
					return dojo.store.JsonRest.prototype.put.apply(this,
							arguments);
				}
			});
	tree = new dijit.Tree({
		model : usGov
	}, "tree"); // make sure you have a target HTML element with this id
	tree.startup();

	//tree click function
	dojo.connect(tree, "onClick", function createStore(object) {
		var mid = object.id;
		var mname = object.name;
		var nodeType = object.nodeType;
		var parent = object.parent;
		alert(mid + "," + mname + "," + nodeType);
		send(mname,parent);

		//if parent node clicked
		if (nodeType == "parent") {
			dojo.style(dojo.byId("accordion"), "display", "block");
			dojo.style(dojo.byId("accordion1"), "display", "none");
			dojo.style(dojo.byId("middlepane"), "display", "block");
			dojo.style(dojo.byId("middlepane1"), "display", "none");
			var xhrArgs = {
				url : "TFgridDetails/" + mname,
				handleAs : "json",
				headers : {
					"Content-Type" : "application/json"
				},
				load : function(data) {
					var newData = {
						items : data.items
					};

					var newStore = new dojo.data.ItemFileWriteStore({
						data : newData,
						id : "dataStoreId"
					});

					var grid = dijit.byId("gridContainer");

					grid.setStore(newStore);
					grid.startup();
				},
				error : function(error) {
					alert("Error");
				}
			};
			var deferred = dojo.xhrGet(xhrArgs);
			var text1 = dijit.byId("TFname"), text2 = dijit
					.byId("TFdescription"), text3 = dijit.byId("TFstatistics");
			var xhrArgs11 = {
				url : "TFdescription/" + mname,
				handleAs : "json",

			};
			var deferred11 = dojo.xhrPost(xhrArgs11);

			deferred11.addCallback(this, function(value) {
				// put retrieved picklists in select.options[]
				var books = value.books;
				text1.setValue(books[0].name);
				text2.setValue(books[1].name);
				text3.setValue(books[2].name);
			});

		}

		//if children node clicked
		else if (nodeType == "children") {
			dojo.style(dojo.byId("accordion1"), "display", "block");
			dojo.style(dojo.byId("accordion"), "display", "none");
			dojo.style(dojo.byId("middlepane1"), "display", "block");
			dojo.style(dojo.byId("middlepane"), "display", "none");
			var xhrArgs = {
				url : "TCgridDetails/" + mname + "/" + parent,
				handleAs : "json",
				headers : {
					"Content-Type" : "application/json"
				},
				load : function(data) {
					var newData = {
						items : data.items
					};

					var newStore = new dojo.data.ItemFileWriteStore({
						data : newData,
						id : "dataStoreId"
					});
					var grid = dijit.byId("grid");
					grid.setStore(newStore);
					grid.startup();

					grid.startup();
				},
				error : function(error) {
					alert("Error");
				}
			};
			var deferred = dojo.xhrGet(xhrArgs);

			var text1 = dijit.byId("TCname"), text2 = dijit
					.byId("TCdescription");
			var xhrArgs21 = {
				url : "TcDescription/" + mname + "/" + parent,
				handleAs : "json",

			};
			var deferred21 = dojo.xhrPost(xhrArgs21);

			deferred21.addCallback(this, function(value) {
				// put retrieved picklists in select.options[]
				var books = value.books;
				text1.setValue(books[0].name);
				text2.setValue(books[1].name);
			});

		}

	});
}

//welcome page
function welcomePageLoad() {
	dojo.style(dojo.byId("accordion"), "display", "block");
	dojo.style(dojo.byId("accordion1"), "display", "none");
	dojo.style(dojo.byId("middlepane"), "display", "block");
	dojo.style(dojo.byId("middlepane1"), "display", "none");
	var mid = "Tf01";
	var xhrArgs = {
		url : "TFgridDetails/" + mid,
		handleAs : "json",
		headers : {
			"Content-Type" : "application/json"
		},
		load : function(data) {
			var newData = {
				items : data.items
			};

			var dataStore = new dojo.data.ItemFileWriteStore({
				data : newData,
				id : "dataStoreId"
			});
			var gridStructure = [ {
				field : "TestCaseNum",
				name : "TestCase No.",
				width : "10%",
				noresize : true
			}, {
				field : "TestCaseName",
				name : "TestCase Name",
				width : "20%",
				noresize : true,
				editable : true
			}, {
				field : "Description",
				name : "Description",
				width : "20%",
				noresize : true,
				editable : true
			}, {
				field : "Type",
				name : "Type",
				width : "20%",
				noresize : true,
				editable : true
			}, ];

			var grid = new dojox.grid.DataGrid({
				store : dataStore,
				rowSelector : "20px",
				structure : gridStructure,
				style : 'width:100%;height:80%;',
			}, "gridContainer");
			grid.startup();
		},
		error : function(error) {
			alert("Error");
		}
	};
	var deferred = dojo.xhrGet(xhrArgs);

	var text1 = dijit.byId("TFname"), text2 = dijit.byId("TFdescription"), text3 = dijit
			.byId("TFstatistics");
	var xhrArgs11 = {
		url : "TFdescription/" + mid,
		handleAs : "json",

	};
	var deferred11 = dojo.xhrPost(xhrArgs11);

	deferred11.addCallback(this, function(value) {
		// put retrieved picklists in select.options[]
		var books = value.books;
		text1.setValue(books[0].name);
		text2.setValue(books[1].name);
		text3.setValue(books[2].name);
	});
	var mid1 = "Tc01";
	var mparent = "Tf01"
	var xhrArgs1 = {
		url : "TCgridDetails/" + mid1 + "/" + mparent,
		handleAs : "json",
		headers : {
			"Content-Type" : "application/json"
		},
		load : function(data) {
			var newData = {
				items : data.items
			};

			var dataStore = new dojo.data.ItemFileWriteStore({
				data : newData,
				id : "dataStoreId"
			});
			var gridStructure = [ {
				field : "FieldName",
				name : "Field Name",
				width : "10%",
				noresize : true
			}, {
				field : "Fieldtype",
				name : "Field Type",
				width : "20%",
				noresize : true,
				editable : true
			}, {
				field : "Permission",
				name : "Permission",
				width : "20%",
				noresize : true,
				editable : true
			}, {
				field : "FieldValue",
				name : "Field Value",
				width : "20%",
				noresize : true,
				editable : true
			}, {
				field : "Xpath",
				name : "Xpath",
				width : "20%",
				noresize : true,
				editable : true
			}, ];

			var grid = new dojox.grid.DataGrid({
				store : dataStore,
				rowSelector : "20px",
				structure : gridStructure,
				style : 'width:100%;height:80%;',
			}, "grid");
			grid.startup();
		},
		error : function(error) {
			alert("Error");
		}
	};
	var deferred1 = dojo.xhrGet(xhrArgs1);
}


//adding rows dynamically

function addTestCases(divName) {
	var newdiv = document.createElement('div');
	newdiv.innerHTML = "<table> <tr><td><input data-dojo-type='dijit/form/TextBox'name='TestCaseNum' id='TestCaseNum' class='textbox1' ></td><td><input data-dojo-type='dijit/form/TextBox' name='TestCaseName' id='TestCaseName' class='textbox1'></td><td><input data-dojo-type='dijit/form/TextBox' name='Description' id='Description' class='textbox1'></td><td><input data-dojo-type='dijit/form/TextBox' name='Type' id='Type' class='textbox1'></td></tr></table>";
	document.getElementById(divName).appendChild(newdiv);

}

















1						dojo.xhrPost ( {
   url: 'submiturl.sapi',
   form: dojo.byId('myFormDomId')
} )

http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_data_grid_setStore.html



http://technofes.blogspot.in/2011/07/spring-ajax-using-ajax-calls-with.html






delete all comparisions with tf and tcs



use nodeType,parent


use gson to convert object into json



simplify




http://blog.m1key.me/2010/02/programming-rest-with-spring-30-spring.html






see xhrget post methods


























microsoft:

username:v.muralikrish9@gmail.com
password:Van@mal@

apache & mysql
Username:root
Password:root


Github
un:v.muralikrish9@gmail.com
pw:krishna516


blaji3rdfloor
security:admin#123
un:shiva62
pw:12345678


shiva2nd floor:
security:987654321
un:
pw:

mobile number
8884828354
8688989787

oracle.com
un:v.muralikrish9@gmail.com
pw:Krishna516

january24,2013----- srs started in bangalore..


oracle-sql
un:system
pw:Krishna516



23-01-2014...icici account opened
long signature.... desk/shortcuts/longsign.png

rubydeer
skey:srs$987&blr
un:
pw:

skyber
skey:srs#1234



github...
gitbash...
tortoise svn...
coursera....



icici:
V@namala14491




linkedin
un:v.muralikrish9@gmail.com
pw:Van@mal@516

http://mail.srsconsultinginc.com/interfaces/sso/login.php

un:muralikrishna@srsconsultinginc.com
pw:Van@mal@5!6




















☺™☼♥  ♠  ♦











<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <bean
        class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />


    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
            <bean
                class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="database" value="MYSQL" />
                <property name="showSql" value="true" />
            </bean>
        </property>
    </bean>
    
    
     <bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource"   destroy-method="close">
 
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
		  <property name="url" value="jdbc:mysql://localhost:3306/expensetracker" />
		  <property name="username" value="root" />
		  <property name="password" value="mysql" />
        
		     <property name="initialSize" value="10"/>
			<property name="maxActive" value="20"/>
			<property name="minIdle" value="0"/>
      
       
	
       
		       
      </bean>
    
	<!--  

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost/expensetracker" />
        <property name="username" value="root" />
        <property name="password" value="mysql" />
    </bean>
-->
    <bean id="transactionManager"
        class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager" />

 
</beans>



DAO

private EntityManagerFactory emf;
EntityManager em = getEmf().createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();


Query query1 = em
								.createQuery("UPDATE CarAttachments ca SET ca.carId=:newCarId WHERE  ca.carId =:ZeroValue");
						query1.setParameter("newCarId", car.getId());
						query1.setParameter("ZeroValue", value);
						saveFiles(em, uploadFileList, deleteFileList);
						deleteFiles(em, deleteFileList);
						query1.executeUpdate();
						tx.commit();


CONTROLLER


private CarService carService;
//getters and setters